package com.superquan.selfstudybootmybatis.utils;

import org.apache.commons.codec.binary.Base64;

import java.nio.charset.Charset;

/**
 * @author zwq
 * @description 测试用
 * @date 2022/7/5
 */
public class OnlyTest {
    public static void main(String[] args) {
        String authHeader1 = getAuthHeader("loadtest1", "A!1X3@5cVvXC8Ut");
        String authHeader2 = getAuthHeader("LDA8208", "P%M>V2d-N#enc&>lFj}sb/G(ci)/Ab{EgT");
        System.out.println(authHeader1);
        System.out.println(authHeader2);
        String s="2021-02-23";
        String s1="2021-02-23 00:00:00.000";
        System.out.println(s.length());
        System.out.println(s1.substring(0,10));
    }

    private static String getAuthHeader(String username, String password) {
        String auth = username + ":" + password;
        byte[] encodedAuth = Base64.encodeBase64(auth.getBytes(Charset.forName("US-ASCII")));
        String authHeader = "Basic " + new String(encodedAuth);
        return authHeader;
    }
}
